Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: new icons using icon gallery #4932

Merged
merged 1 commit into from
Feb 15, 2024
Merged

refactor: new icons using icon gallery #4932

merged 1 commit into from
Feb 15, 2024

Conversation

fbwoolf
Copy link
Contributor

@fbwoolf fbwoolf commented Feb 9, 2024

Try out this version of Leather — Extension build, Test report

EDIT: OPEN FOR REVIEW
Note: there ended up being a constant issue trying to pass the prop size with panda and assigning it to the svg height and width, so I ended up changing the prop name on all the icons to just be setting height and width using the size token instead.

Draft proposal:
I wanted to open this up as a draft for feedback on the direction. I ended up following the storybookjs/icons pattern so that we can have an mdx docs file that shows all the icons on one page, while at the same time we have the flexibility to add a story for each icon if we feel it is necessary. I prefer how the first example, the one I followed, ends up rendering in Storybook even though the code is a bit less DRY.

Example I followed:
https://github.com/storybookjs/icons
(storybook)
https://main--64b56e737c0aeefed9d5e675.chromatic.com/?path=/docs/introduction--docs

This is another example we could follow where we simplify the amount of icon components we have by instead keeping a shared list of just icon paths and render them in one icon story:

Alternative example:
https://github.com/storybookjs/design-system/blob/b852133e5e75f410a4f43171ceb31438e344b5b3/src/components/Icon.tsx
(storybook)
https://master--5ccbc373887ca40020446347.chromatic.com/?path=/docs/icon--docs

Current implementation with mdx docs and one example icon story:
Screenshot 2024-02-14 at 12 05 38 PM

Screenshot 2024-02-14 at 1 47 21 PM

@fbwoolf fbwoolf linked an issue Feb 9, 2024 that may be closed by this pull request
@fbwoolf fbwoolf requested review from kyranjamie, pete-watters, edgarkhanzadian and fabric-8 and removed request for edgarkhanzadian February 9, 2024 20:54
Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me Fara. Let me know when it's fully ready and I can re-check but I like the approach and it's great to be able to see the icons

@leather-io leather-io deleted a comment from fbwoolf Feb 13, 2024
@mica000
Copy link

mica000 commented Feb 13, 2024

@fbwoolf I accidentally deleted your comment. So sorry! Can't seem to retrieve it.

But the "Current implementation with mdx docs and one example icon story" is perfect! The only thing I noticed so far is the naming "Standard 16x16" and "Standard 24x24", while it should be "Small 16x16" and "Default 24x24"

I also dont think we need one story per icon as this would serve the modulation of the icons, however this is already defined by us when bringing the icon into Figma and defining it to be 16 and 24.

Great job!!! 🥳

Copy link
Collaborator

@kyranjamie kyranjamie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of great work here @fbwoolf

src/app/ui/icons/icon.tsx Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@fbwoolf fbwoolf force-pushed the refactor/icons branch 3 times, most recently from ad0f1c2 to 7eb6805 Compare February 14, 2024 18:06
@fabric-8
Copy link
Contributor

@fbwoolf Happy to see this happen and the the storybook previewing is super useful!

Do you already want me to check out the build or should I hold back a little longer? Would also be great if we could switch out the home icon for the new ones while at it :)

CleanShot 2024-02-14 at 23 03 51@2x

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Feb 15, 2024

@fbwoolf Happy to see this happen and the the storybook previewing is super useful!

Do you already want me to check out the build or should I hold back a little longer? Would also be great if we could switch out the home icon for the new ones while at it :)

Nice, yeah I can swap those out. I am still testing the changes bc broke some things but will open the PR tonight or tom and will ping you to test once open. Thanks for the feedback today in Figma.

@fbwoolf fbwoolf force-pushed the refactor/icons branch 2 times, most recently from 53f2f52 to b1389df Compare February 15, 2024 02:18
@fbwoolf fbwoolf marked this pull request as ready for review February 15, 2024 02:31
@fbwoolf
Copy link
Contributor Author

fbwoolf commented Feb 15, 2024

Screenshot 2024-02-14 at 7 54 34 PM

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Feb 15, 2024

I need to fix the lint issue here, but opening it up for review and design QA.

Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 nice work Fara. LGTM 👍

  • I'm curious about using token, I guess we need to but not sure why? Panda?
  • Smart move using width instead of size. I'd suggest naming it variant but width makes as much sense

Comment on lines 9 to 12
color?: string;
opacity?: string;
strokeWidth?: string;
width?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw you replied to comment, but these are still here? Are they needed for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a comment in the code left as to why. I removed them, but got type errors bc the underlying component we use is a path element not a styled component which seem to create type errors unless I redefined here. I can try using a styled.path and removing them but not sure if that will work and did not seem to allow for changing the color with the color picker in storybook (which maybe isn't nec?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out a better way to handle the types, so I was able to remove these again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be good to keep the mdx right beside the story so thing.stories.mdx isn't a bad pattern.

I'm fine with a docs/ folder too though

@@ -0,0 +1,50 @@
import { IconGallery, IconItem, Meta } from '@storybook/blocks';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is exclusive for storybook, maybe the filename should annotate this? Is there a common pattern for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two patterns I was ref'ing from storybook examples, there are links in the description here. There wasn't a pattern in naming with mdx files that I saw. Typically it was just named as the component name with the extension or something like introduction.mdx for a doc file introducing the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a docs folder and moved it there.

@@ -0,0 +1,53 @@
export const iconsList = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is only for storybook, isn't a node function to get list from tree trivial and not require updating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look at this, I followed what the storybook example did, but that might be a better so can give it a shot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at this, I'm not sure it is trivial to do and we might want to control the gallery shown manually? I did reorg the files a bit so there is a docs folder which contains the mdx file and the list to display in the docs gallery.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, this is pretty trivial so changed.

@fbwoolf fbwoolf force-pushed the refactor/icons branch 5 times, most recently from a70ebc8 to 09c994f Compare February 15, 2024 22:08
@fbwoolf fbwoolf added this pull request to the merge queue Feb 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 15, 2024
@fbwoolf fbwoolf added this pull request to the merge queue Feb 15, 2024
Merged via the queue into dev with commit dc1bf28 Feb 15, 2024
28 checks passed
@fbwoolf fbwoolf deleted the refactor/icons branch February 15, 2024 23:01
@fbwoolf
Copy link
Contributor Author

fbwoolf commented Feb 15, 2024

@fabric-8 I merged this into dev so @pete-watters can use the icons in his new settings work. If you test it and find any needed changes, can you track them in a new issue and assign to me?

@pete-watters
Copy link
Contributor

I just noticed that the Collectibles loading spinner looks different. Is that intentional?

LoadingIcon.mp4

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Feb 16, 2024

I just noticed that the Collectibles loading spinner looks different. Is that intentional?

I did replace it with a new icon called ReloadIcon but we can add the one called Refresh if makes more sense here? I think there was some discussion abt it while @fabric-8 was out, but I can add back the refresh icon if better here? I wasn't sure there was a diff b/w Reload and Refresh.

EDIT: O, I see now you meaning the animation! Haha, I will look at it and fix! Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update icons package
5 participants